package org.kamionowski.supreme.persistence.dao.beans;

import java.util.Date;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Marcin Kamionowski
 * Date: 13.04.11
 * Time: 16:18
 */
public class FileSearchBean {
    private final Date modificationFrom;
    private final Date modificationTo;
    private final Boolean caseMatch;
    private final List<String> extensions;
    private final List<String> tokens;

    static public class Builder{
        private Date modificationFrom;
        private Date modificationTo;
        private Boolean caseMatch;
        private List<String> extensions;
        private List<String> tokens;

        public void setModificationFrom(Date modificationFrom) {
            this.modificationFrom = modificationFrom;
        }

        public void setModificationTo(Date modificationTo) {
            this.modificationTo = modificationTo;
        }

        public void setCaseMatch(Boolean caseMatch) {
            this.caseMatch = caseMatch;
        }

        public void addExtension(String ext){
            extensions.add(ext);
        }

        public void addToken(String token){
            tokens.add(token);
        }

        public FileSearchBean build(){
            return new FileSearchBean(this);
        }
    }

    public FileSearchBean(Builder builder) {
        this.modificationFrom = builder.modificationFrom;
        this.modificationTo = builder.modificationTo;
        this.caseMatch = builder.caseMatch;
        this.extensions = builder.extensions;
        this.tokens = builder.tokens;
    }

    public Date getModificationFrom() {
        return modificationFrom;
    }

    public Date getModificationTo() {
        return modificationTo;
    }

    public Boolean getCaseMatch() {
        return caseMatch;
    }

    public List<String> getExtensions() {
        return extensions;
    }

    public List<String> getTokens() {
        return tokens;
    }
}
